package com.oscarmovie.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.oscarmovie.model.Language;

public class LanguageDaoImpl extends HibernateDaoSupport implements LanguageDao {

	
	public void save(Language language) {
		getSession().saveOrUpdate(language);
	}

	public Language load(int id) {
		Language language = (Language)getSession().load(Language.class, id);
		return language;
	}
	
	
	public List<Language> loadAll() {
		Query query = getSession().createQuery("from Language ");
		query.setCacheable(true);
		List<Language> list = (List<Language>)query.list();
		return list;
	}
	
}
